package com.xbongbong.saas.model.impl;

import com.xbongbong.pro.domain.dao.HomePageManageDao;
import com.xbongbong.pro.domain.entity.HomePageManageEntity;
import com.xbongbong.saas.model.HomePageManageModel;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @ClassName HomePageManageModelImpl
 * @Description 首页管理
 * @Author mengna.Deng
 * @Date 2021/11/1 14:07
 * @Version 1.0
 */
@Service("homePageManageModel")
public class HomePageManageModelImpl implements HomePageManageModel {

    @Resource
    private HomePageManageDao homePageManageDao;

    @Override
    public Integer insert(HomePageManageEntity entity){
        return homePageManageDao.insert(entity);
    }

    @Override
    public Integer update(HomePageManageEntity entity){
        return homePageManageDao.update(entity);
    }

    @Override
    public List findEntitys(Map<String, Object> param) {
        return homePageManageDao.findEntitys(param);
    }

    @Override
    public Integer getEntitysCount(Map<String, Object> param) {
        return homePageManageDao.getEntitysCount(param);
    }

    @Override
    public List findEntitysWithoutSub(Map<String, Object> param) {
        return null;
    }

    @Override
    public Integer save(HomePageManageEntity entity){

        if(entity.getId() == null || entity.getId().equals(0L)) {
            return homePageManageDao.insert(entity);
        }
        return homePageManageDao.update(entity);
    }

    @Override
    public Integer deleteByKey(Long key, String corpid) {return homePageManageDao.deleteByKey(key, corpid);}

    @Override
    public void insertBatch(List<HomePageManageEntity> entityList) {
        homePageManageDao.insertBatch(entityList);
    }

    @Override
    public HomePageManageEntity getByKey(Long key, String corpid) {
        return homePageManageDao.getByKey(key, corpid);
    }

    @Override
    public void updateBatch(List<HomePageManageEntity> entityList, String corpid) {
        homePageManageDao.updateBatch(entityList, corpid);
    }
}
